import { request } from '@/utils/request'
// 集中拼接处理
export async function gets(data, api) {
    return request(api, 'get', data)
}

export async function get(id, api) {
    return request(`${api}/${id}`, 'get')
}

export async function del(id, api) {
    return request(`${api}/${id}`, 'delete')
}

export async function updata(data, api) {
    return request(`${api}/${data.id}`, 'put', data)
}

export async function add(data, api) {
    return request(api, 'post', data)
}
// 以下为通用
export async function getRequest(data, api) {
    return request(api, 'get', data)
}

export async function putRequest(data, api) {
    return request(api, 'put', data)
}

export async function postRequest(data,api,config={}) {
    console.log('发送前',data);
    return request(api, 'post', data,config)
}

export default {
    gets,
    updata,
    del,
    add,
    get,
    getRequest,
    putRequest,
    postRequest
}
